import axios from '@/libs/api.request'
import { getToken } from '@/libs/util'
// =============== news-system/advertisements/list.vue =========================
let auth_token = getToken();
//车辆列表
export const getTableData = (page_current, page_size, searchData) => {
  return axios.request({
    url: 'api/v1.cuser.car/index',
    params: {
      page_current: page_current,
      page_size: page_size,
      auth_token:auth_token,
      dot_id :searchData.dot_id,
      status:searchData.status,
      apply_status:searchData.apply_status
    },
    method: 'get'
  })
}

//筛选数据
export const getData = () => {
  return axios.request({
    url: 'api/v1.cuser.car/get_data',
    params: {
      auth_token:auth_token,
    },
    method: 'get'
  })
}

//品牌类型
export const getBrandType = () => {
  return axios.request({
    url: 'api/v1.cuser.car/brand_type_index',
    params: {
      auth_token:auth_token,
      is_pages:0
    },
    method: 'get'
  })
}



export const addCar = (formData) => {
  formData.auth_token = auth_token;
  return axios.request({
    url: 'api/v1.cuser.car/create',
    data:formData,
    method: 'post'
  })
}

export const editCar = (formData) => {
  formData.auth_token = auth_token;
  return axios.request({
    url: 'api/v1.cuser.car/update',
    data:formData,
    method: 'post'
  })
}

export const getInfo = (car_id) => {
  return axios.request({
    url: 'api/v1.cuser.car/read',
    params: {
      car_id: car_id,
      auth_token:auth_token,
      type:1
    },
    method: 'get'
  })
}

export const getPos = (car_id) => {
  return axios.request({
    url: 'api/v1.cuser.car/pos_read',
    params: {
      car_id: car_id,
      auth_token:auth_token,
    },
    method: 'get'
  })
}

export const changeStatus = (car_id,status) => {
	 let formData={
    	  car_id:car_id,
    	  status:status,
    	  auth_token:auth_token,
   };
	
  return axios.request({
    url: 'api/v1.cuser.car/change_status',
    data:formData,
    method: 'post'
  })
}

export const delCar = (car_id) => {
	 let formData={
    	  car_id:car_id,
    	  auth_token:auth_token,
   };
	
  return axios.request({
    url: 'api/v1.cuser.car/delete',
    data:formData,
    method: 'post'
  })
}
